package com.yuju.enums;

/**
 * 类名：ReturnCodeEnum  <br />
 *
 * 功能：业务代码枚举
 *
 * @author : xuehj <br />
 * @Date : 2017年9月12日 下午4:42:14  <br />
 * @version : 1.1 <br />
 */
public enum ReturnCodeEnum {
	NO_DATA("yuju-1000", "无数据"),
	TOKEN_ERROR("yuju-1001", "token验证失败"),
	NO_UPDATE_RECORD("yuju-1002", "无更新记录"),
	VALIDATE_ERROR("yuju-1003", "参数校验未通过"),
	PARAM_ERROR("yuju-1004", "参数异常"),
	UMKNOWN_ERROR("yuju-1005", "未知异常"),
	NO_REGISTER("yuju-1006", "用户未注册"),
	LOGIN_SUCCESS("yuju-1007", "登录成功"),
	LOGIN_FAILURE("yuju-1008", "登录失败"),
	REGISTER_SUCCESS("yuju-1009", "注册成功"),
	REGISTER_FAILURE("yuju-1010", "注册失败"),
	VALID_CODE_EXPIRE("yuju-1011", "验证码已过期"),
	VALID_CODE_ERROR("yuju-1012", "验证码错误"),
	WX_OAUTH2_FAILURE("yuju-1013", "微信OAUTH2验证失败"),
	MOBILE_VALID_FAILURE("yuju-1014", "请输入正确的手机号码"),
	PASSWORD_VALID_NOT_NULL("yuju-1015", "请输入密码"),
	SEND_VALID_CODE_SUCCESS("yuju-1016", "短信验证码发送成功"),
	SEND_VALID_CODE_FAILURE("yuju-1017", "短信验证码发送失败"),
	MODIFY_PWD_SUCCESS("yuju-1018", "修改密码成功"),
	MODIFY_PWD_FAILURE("yuju-1019", "修改密码失败"),
	YES_REGISTER("yuju-1020", "用户已注册"),
	ORDER_NO_GEN_FALURE("yuju-1021", "编号生成失败"),
	NO_LOGIN("yuju-1022", "用户未登录"),
	VALID_REPEAT_SUCCESS("yuju-1023", "重名验证已通过"),
	VALID_REPEAT_FAILURE("yuju-1024", "重名验证未通过"),
	LOGIN_USER_NOT_FOUND("yuju-1025", "用户不存在"),
	LOGIN_PWD_ERROR("yuju-1025", "密码错误");
	
	private String code;
	private String desc;
	
	ReturnCodeEnum(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	
	public static String getDescByCode(String code) {
		for (ReturnCodeEnum enume : ReturnCodeEnum.values()) {
			if (enume.getCode().equals(code)) {
				return enume.getDesc();
			}
		}
		return "未知枚举项";
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}
}
